fix(c/driver/postgresql): honor GetObjects schema filter#3855
Merged
lidavidm merged 4 commits intoapache:mainfrom Jan 6, 2026
Merged
fix(c/driver/postgresql): honor GetObjects schema filter#3855lidavidm merged 4 commits intoapache:mainfrom
lidavidm merged 4 commits intoapache:mainfrom
Conversation
Remove pg_table_is_visible() from the tables query so schema filtering does not depend on search_path.\n\nAdd regression coverage in the C++ PostgreSQL driver tests and Python DBAPI tests.
lidavidm
approved these changes
Jan 5, 2026
Member
|
Thanks! |
Member
|
It seems other tests leave behind some stuff that causes the new test to fail. Maybe it can be a little more forgiving? |
… extra catalogs PostgreSQL exposes template catalogs (template0/template1) so GetObjects may return multiple catalog rows even when schema/table filters are used. Update the regression test to select the current catalog entry.
Contributor
Author
|
Pushed a follow-up commit to make the Python regression test tolerant of Postgres returning multiple catalogs (e.g., template0/template1). The test now selects the current catalog entry instead of assuming a single row. |
Member
|
The linter made a change 😅 diff --git a/python/adbc_driver_postgresql/tests/test_dbapi.py b/python/adbc_driver_postgresql/tests/test_dbapi.py
index aae214275..5fe72cfa3 100644
--- a/python/adbc_driver_postgresql/tests/test_dbapi.py
+++ b/python/adbc_driver_postgresql/tests/test_dbapi.py
@@ -24,6 +24,7 @@ import numpy
import pyarrow
import pyarrow.dataset
import pytest
+
from adbc_driver_postgresql import ConnectionOptions, StatementOptions, dbapi
@@ -81,7 +82,9 @@ def test_get_objects_schema_filter_outside_search_path(
)
catalog_name = postgres.adbc_current_catalog
- catalog = next((row for row in metadata if row["catalog_name"] == catalog_name), None)
+ catalog = next(
+ (row for row in metadata if row["catalog_name"] == catalog_name), None
+ )
assert catalog is not None
schemas = catalog["catalog_db_schemas"] |
lidavidm
reviewed
Jan 6, 2026
lidavidm
reviewed
Jan 6, 2026
Contributor
Author
|
Re-ran the CI-style flow locally (Ubuntu container + compose |
jhrotko
pushed a commit
to jhrotko/arrow-adbc
that referenced
this pull request
Feb 2, 2026
## Summary Fix the PostgreSQL driver’s `GetObjects` table enumeration so `db_schema` / `db_schema_filter` does not depend on `search_path`. ## Details The tables query used `pg_catalog.pg_table_is_visible(c.oid)`, which is `search_path`-dependent and can hide tables in non-current schemas even when a schema filter is provided. Remove that predicate and rely on the explicit schema predicate. ## Tests - `pre-commit run` - `ctest -L driver-postgresql` (against `postgres-test` from `docker compose`) Closes apache#3854 --------- Co-authored-by: Matthew Corley <matt.corley@freenome.com> Co-authored-by: David Li <li.davidm96@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the PostgreSQL driver’s
GetObjectstable enumeration sodb_schema/db_schema_filterdoes not depend onsearch_path.Details
The tables query used
pg_catalog.pg_table_is_visible(c.oid), which issearch_path-dependent and can hide tables in non-current schemas even when a schema filter is provided. Remove that predicate and rely on the explicit schema predicate.Tests
pre-commit runctest -L driver-postgresql(againstpostgres-testfromdocker compose)Closes #3854